<!DOCTYPE html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<div style="margin-top:120%"><input id="checkbox" type="checkbox" /></div>
<input id="input" value="foo">
<script>
promise_test(() =>{return new Promise((resolve) => {
  if (window.eventSender === undefined)
    return reject('required window.eventSender');
  checkbox.focus();
  setTimeout(resolve, 0);
}).then(() => {
  var scrollY = window.scrollY;
  assert_greater_than(window.scrollY, 0);
  assert_equals(document.activeElement, checkbox);
  eventSender.keyDown('Tab');
  assert_equals(document.activeElement, input);
  eventSender.keyDown('Tab', ['shiftKey']);
  assert_equals(document.activeElement, checkbox);
  eventSender.keyDown('Tab');
  return new Promise((resolve) => {
    setTimeout(resolve(scrollY), 0);
  });
}).then((scrollY) => {
  assert_equals(window.scrollY, scrollY, 'Screen should not scroll');
});});
</script>
